Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Subscription base class on app instance #3058

Merged
merged 3 commits into from
Oct 8, 2018

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Sep 28, 2018

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@fengmk2
Copy link
Member Author

fengmk2 commented Sep 28, 2018

估计之前没有人用 class 写过 schedule

@codecov
Copy link

codecov bot commented Sep 28, 2018

Codecov Report

Merging #3058 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3058      +/-   ##
==========================================
+ Coverage   99.75%   99.75%   +<.01%     
==========================================
  Files          29       29              
  Lines         829      830       +1     
==========================================
+ Hits          827      828       +1     
  Misses          2        2
Impacted Files Coverage Δ
lib/egg.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b13d904...8ca9516. Read the comment docs.

@popomore
Copy link
Member

有的吧,都直接 require 的

'use strict';

module.exports = app => {
return class LoggerExample extends app.Subscription {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

说个题外的,我倒是挺想加个 app.Schedule 的,而不是让定时任务直接继承基类 Subscription

不过插件里面好像没法挂。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么还要多一个 Schedule 呢?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schedule 就像 Controller 这样的基类。
Subscription 不是 Schedule 专用的。

@fengmk2
Copy link
Member Author

fengmk2 commented Sep 29, 2018

有的吧,都直接 require 的

应用层可以 require,但是插件只能通过 app 获取。

@atian25
Copy link
Member

atian25 commented Sep 29, 2018

估计之前没有人用 class 写过 schedule

目前 class 的方式用起来有点别扭

@dead-horse dead-horse merged commit 886d9ad into master Oct 8, 2018
@dead-horse dead-horse deleted the add-missing-Subscription-on-app branch October 8, 2018 02:52
popomore pushed a commit that referenced this pull request Oct 8, 2018
feat: add Subscription base class on app instance (#3058)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants